package com.zlzlib.libuimodel.bean;

import androidx.annotation.Nullable;

/**
 * Created by zlz on 2019/8/29.
 * 数据
 */
public class SourceData {

    @Nullable
    public Object data;

    @Nullable
    public String message;

    @Nullable
    public Throwable error;

    public static SourceData data(Object data) {
        SourceData sourceData = new SourceData();
        sourceData.data = data;
        return sourceData;
    }

    public static SourceData data(Object data, String msg) {
        SourceData sourceData = new SourceData();
        sourceData.data = data;
        sourceData.message = msg;
        return sourceData;
    }

    public static SourceData msg(String data) {
        SourceData sourceData = new SourceData();
        sourceData.message = data;
        return sourceData;
    }

    public static SourceData msg(String msg, Object data) {
        SourceData sourceData = new SourceData();
        sourceData.message = msg;
        sourceData.data = data;
        return sourceData;
    }

    public static SourceData error(Throwable data) {
        SourceData sourceData = new SourceData();
        sourceData.error = data;
        return sourceData;
    }
}
